package com.colorlight.cloud.grandshow;

import com.colorlight.cloud.Util;
import com.colorlight.cloud.common.utils.HexUtil;
import com.colorlight.cloud.gateway.api.message.constraint.protocol.ProtocolType;
import com.colorlight.cloud.gateway.api.message.constraint.schedule.ScheduleActions;
import com.colorlight.cloud.gateway.api.message.convert.CommandConvert;
import com.colorlight.iot.proto.grandshow.event.GrandShowEvent;
import com.google.protobuf.ByteString;
import com.google.protobuf.MessageLite;
import com.iot.proto.type.ProtocolSummationType;
import org.junit.jupiter.api.Test;

/**
 * @author Demon
 * @date 10/5/2024  上午10:17
 */
public class ToMsg {
	
	private ProtocolSummationType.NameStruct getNameStruct(ScheduleActions f) {
		
		ProtocolType protocolType = f.getProtocolType();
		String thisName = protocolType.getThisName();
		return ProtocolSummationType.NameStruct.valueOf(thisName);
	}
	
	@Test
	public void test_HB() {
		GrandShowEvent.HB.Builder builder = GrandShowEvent.HB.newBuilder();
		ByteString bytes = builder.build().toByteString();
		
		MessageLite convert = CommandConvert.convertMsg(bytes, "7777-888-999-999", 11111L,ProtocolSummationType.NameStruct.HBEvent);
		Util.printByteArray(convert.toByteArray());
		System.out.println(HexUtil.toHex(convert.toByteArray()));
		
	}
//
//	@Test
//	public void test_HB() {
//		GrandShowEvent.HB.Builder builder = GrandShowEvent.HB.newBuilder();
//		ByteString bytes = builder.build().toByteString();
//
//		MessageLite convert = CommandConvert.convertMsg(bytes, "7777-888-999-999", 11111L,ProtocolSummationType.NameStruct.HBEvent);
//		Util.printByteArray(convert.toByteArray());
//		System.out.println(HexUtil.toHex(convert.toByteArray()));
//
//	}
	
}
